package
{
	import com.karst.flab3d.Basic3dSample;
	
	import flash.display.Sprite;
	import flash.events.Event;
	
	import org.aswing.AsWingManager;
	import org.aswing.Container;
	import org.aswing.FlowLayout;
	import org.aswing.JWindow;
	
	public class Flab3dStudy extends Sprite
	{
		public function Flab3dStudy()
		{
			super();
			initStage() ;
			createView() ;
		}
		
		private function initStage() : void
		{
			AsWingManager.initAsStandard( this ) ;
		}
		
		private function createView() : void
		{
			createWindow() ;
			createView01() ;
			addEvents() ;
		}
		
		private var window : JWindow = null ;
		private var pane : Container = null ;
		private function createWindow() : void
		{
			if( window == null )
			{
				window = new JWindow( this ) ;
				window.setSizeWH( stage.stageWidth, stage.stageHeight ) ;
			}
			
			if( pane == null )
			{
				pane = window.getContentPane() ;
				pane.setLayout( new FlowLayout() ) ;
			}
			
			window.show() ;
		}

		private var base3d : Basic3dSample = null ;
		private function createView01() : void
		{
			if( base3d == null )
				base3d = new Basic3dSample() ;
			pane.addChild( base3d ) ;
		}
		
		
		
		
		private function addEvents() : void
		{
			AsWingManager.getStage().addEventListener( Event.RESIZE, stageResizeHandler ) ;
		}
		
		private function stageResizeHandler( event : Event ) : void
		{
			window.setSizeWH( stage.stageWidth, stage.stageHeight ) ;
		}
	}
}